<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<%@ include file="/common/query.jsp"%>
<%@ include file="/common/det.jsp"%>

<script>
        $(function(){
            init();
        });
        function init(){
            var setting = {};
            var url ="";
            var p_insert = false;
            var p_del = false;
            var search = (getQueryStringByDecode("search")=="" || getQueryStringByDecode("search")=="true");
			var singleSelect = (getQueryStringByDecode("singleSelect")=="" || getQueryStringByDecode("singleSelect")=="true");
			var productCategoryAttrgroupId = getQueryStringByDecode("productCategoryAttrgroupId");
            var columns = [
                {field:'id',title:'id',hidden:true},
                {field:'name',title:'属性名',require:true,search:{type:"single"}},
                {field:'enName',title:'英文属性名',require:true},
                {field:'inputType',title:'输入类型',hidden:!search,search:{type:"single"},
                    input:{type:'radio',value : [{text:'文本输入',value:0,isDefault:true},{text:'单选',value : 10},{text:'多选',value : 20}]}
                },
				{
                    field:"isSale",title:"销售属性",search:{type:"single"},
                    input:{type:'radio',value : [{text: 'N',value:0,isDefault:true},{text:'Y',value : 1}]}
                },
                {field:"isKey",title:"关键属性",rowHidden:!search,search:{type:"single"},input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isColor",title:"颜色属性",rowHidden:!search,search:{type:"single"},input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isProduct",title:"商品属性",rowHidden:!search,search:{type:"single"},input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isQuery",title:"查询属性",rowHidden:!search,search:{type:"single"},input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isEnum",title:"枚举属性",rowHidden:!search,input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isInput",title:"自行输入",rowHidden:!search,input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isMobileInput",title:"移动端填写",rowHidden:!search,input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isAlias",title:"允许别名",rowHidden:true,input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isPublishProductRequireSelect",title:"必选属性",input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isPublishProductMulit",title:"是否可多选",input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isPublishProductRequireInput",title:"是否必填",input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"isMeasurement",title:"度量衡",rowHidden:true,input:{type:'radio',value : [{text:'N',value:0,isDefault:true},{text:'Y',value : 1}]}},
                {field:"measurementUnit",title:"单位",rowHidden:true,
                    dialog:{
                        mapper:{name:"属性名"},
                        url:"${base}/base/measurement?edit=false",
                        width:300,
                        height:300,
                        select:function(iframe){
                            var row = iframe.getGridChecked()[0];
                            $('#crud-measurementUnit').val(row.name);
                        }
                    }

				},
                {field:"orderBy",title:"排序",defaultValue:0},
                {field:'enable',title:'状态',hidden:!search,search:{type:"single"},
                    input:{type:'radio',value : [{text:'未启用',value:0,isDefault:true},{text:'已启用',value : 1}]}
                }

            ];
            url='/product/attr/manager?';
            if(!search){
                url += "&search_EQ_enable=1"
			}
			if(productCategoryAttrgroupId!=null){
                url += "&productCategoryAttrgroupId="+productCategoryAttrgroupId;
			}
            //setting.singleSelec	t = true;
            createQuery('body',columns,{
                pager:false,edit:search,add:search,searchBar:{hidden:!search},del:search,heji:false,
                singleSelect:singleSelect,xuhao:false,
                onClickRow:function () {
                    if(!search){
                            seeProductAttrValue();
                    }
                }
			},url);
        };
        function seeProductAttrValue() {
                var row = getGridSelected();
                window.parent.seeProductAttrValue(row);
        }

</script>
</head>
<body>
	  <div id="body"></div>
</body>
</html>